<template>
  <form @submit.prevent="addHero">
    <table border="1" align="center">
      <tr><td>英雄</td><td><input type="text" v-model="hero.name"/></td></tr>
      <tr><td>武器</td><td><input type="text" v-model="hero.weapon"/></td></tr>
      <tr><td>攻击力</td><td><input type="text" v-model="hero.atk"/></td></tr>
      <tr><td colspan="2"><input type="submit" /> </td></tr>
    </table>
  </form>
</template>

<script>
    export default {
      name: "HeroAdd",
      data(){
        return {hero:{}}
      },
      methods:{
        addHero(){
          this.axios({
            method:"get",
            url:"/hero/add.do",
            params:this.hero
          }).then((resp)=>{
            this.$router.push("/showHero");
          });
        }
      }
    }
</script>

<style scoped>

</style>
